package top.soulblack.purchasesale.mapper.system;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import top.soulblack.purchasesale.model.Shop;

import java.util.List;

@Mapper
public interface ShopMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(Shop record);

    int insertSelective(Shop record);

    Shop selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Shop record);

    int updateByPrimaryKey(Shop record);

    @Select("select * from shop order by sort")
    List<Shop> selectAll();

    @Insert("insert into shop (name, address, sort, phone) values (#{name}, #{address}, #{sort}, #{phone})")
    void addShop(Shop shop);

    @Select("select count(*) from shop where name = #{name}")
    int existShop(String name);
}